package com.usian.admin.controller;

import com.usian.admin.WmNewsAuthControllerApi;
import com.usian.admin.feign.WemediaFeign;
import com.usian.model.admin.dtos.NewsAuthDto;
import com.usian.model.common.dtos.PageResponseResult;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/news_auth")
public class WmNewsAuthController implements WmNewsAuthControllerApi {

    @Autowired
    private WemediaFeign wemediaFeign;


    @PostMapping("/list")
    @Override
    public PageResponseResult findNewsRenGongPage(@RequestBody NewsAuthDto dto) {
        PageResponseResult result = wemediaFeign.findNewsRenGongPage(dto);
        return result;
    }

    @GetMapping("/one/{id}")
    @Override
    public ResponseResult findOne(@PathVariable Integer id) {
        return wemediaFeign.findOne(id);
    }


    @PostMapping("/auth_pass")
    @Override
    public ResponseResult authPass(@RequestBody NewsAuthDto dto) {
        return wemediaFeign.authNewsRenGong(dto);
    }

    @PostMapping("/auth_fail")
    @Override
    public ResponseResult authFail(@RequestBody NewsAuthDto dto) {
        return wemediaFeign.authNewsRenGong(dto);
    }
}
